package com.mini.es.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mini.constant.OrderChannelType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import java.util.Date;


@Data
@ToString
@ApiModel(value = "大课订单列表的对象")
public class BusinessBigLessonOrder {


    @ApiModelProperty(value = "[大课]大课订单号")
    private String boOrderNo;
//    @EncryptField
    @ApiModelProperty(value = "[大课]大课订单手机号")
    private String boPhoneNo;
    @ApiModelProperty(value = "[大课]大课商品id")
    private Long boLessonId;
    @ApiModelProperty(value = "[大课]大课商品名称")
    private String boLessonName;
    @ApiModelProperty(value = "[大课]大课成单渠道：1-直播带货，0-有赞")
    private Integer boOrderSourceType;
    @ApiModelProperty(value = "[大课]大课成单时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date boOrderPayFinishTime;
    @ApiModelProperty(value = "[大课]大课商品价格")
    private Float boPrice;
    @ApiModelProperty(value = "[大课]大课实付金额")
    private Float boPayAmount;
    @ApiModelProperty(value = "[大课]订单状态code")
    private String boOrderState;
    @ApiModelProperty(value = "[大课]订单状态name")
    private String boOrderStateStr;
    @ApiModelProperty(value = "[大课]备注")
    private String boOperateRemark;

    private String boCouponCode;
    @ApiModelProperty(value = "[大课]定金尾款类型：0-整单，1-定金，2-尾款")
    private Integer boOrderDepositType;
    @ApiModelProperty(value = "[大课]关联字段，定义哪些是一套订单")
    private String boRelatedKey;

    @ApiModelProperty(value = "[大课][定金]定金订单号")
    private String boDepositOrderNo;
    @ApiModelProperty(value = "[大课][定金]定金与尾款的绑定状态：1-绑定，0-未绑定")
    private Integer boDepositMergeState;
    @ApiModelProperty(value = "[大课][定金]定金支付时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date boDepositPayTime;
    private Long boDepositLessonId;
    @ApiModelProperty(value = "[大课][定金]定金名称")
    private String boDepositLessonName;
    @ApiModelProperty(value = "[大课][定金]定金支付金额")
    private Float boDepositPayAmount;
    @ApiModelProperty(value = "[20201203][大课]业务类型code")
    private Integer boOrderChannelType;
    @ApiModelProperty(value = "[20201203][大课]业务类型")
    private String boOrderChannelTypeName;

    @ApiModelProperty(value = "[小课]小课订单关联类型（小课订单手机号栏位使用）：0-无匹配小课+无设置归属，1-系统匹配，2-人工匹配，3-无匹配小课，设置了归属")
    private Integer moRelateFlag;

    @ApiModelProperty(value = "[小课]订单编号")
    private String moOrderNo;

    @ApiModelProperty(value = "[小课]支付手机号")
//    @EncryptField
    private String moPhoneNo;

    @ApiModelProperty(value = "[小课]小课业务ID")
    private Long moMiniLessonId;

    @ApiModelProperty(value = "[小课]业务线，0加盐业务线 1集团业务线")
    private Integer moBusinessType;

    @ApiModelProperty(value = "[小课]小课订单支付时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date moOrderPayTime;

    @ApiModelProperty(value = "[小课]小课商品id")
    private String moLessonId;
    @ApiModelProperty(value = "[小课]小课商品名称")
    private String moLessonTitle;


    @ApiModelProperty(value = "[小课]微信备注昵称")
    private String moWechatNameNote;
    @ApiModelProperty(value = "[小课]微信昵称")
    private String moWechatName;

    @ApiModelProperty(value = "[小课]微信号")
    private String moWxId;
    @ApiModelProperty(value = "[小课]学员id")
    private String moStudentId;
    @ApiModelProperty(value = "[小课]姓名")
    private String moNickName;
    @ApiModelProperty(value = "[小课]班次信息")
    private String moClassName;

    @ApiModelProperty(value = "[小课]运营专员id")
    private Long yyTeacherId;

    @ApiModelProperty(value = "[小课]运营专员名称")
    private String yyTeacherName;

    @ApiModelProperty(value = "[小课]运营老师email")
    private String yyTeacherEmail;

    @ApiModelProperty(value = "[小课]运营老师nickname")
    private String yyTeacherUsername;


    @ApiModelProperty(value = "[小课]渠道code")
    private String channelCode;
    @ApiModelProperty(value = "[小课]渠道name")
    private String channelName;

    @ApiModelProperty(value = "[20201203][大课]大课skuCode")
    private String skuCode;

    @ApiModelProperty(value = "[20201203][大课]大课sku名称")
    private String skuName;


    @ApiModelProperty(value = "[20201203][小课]事业部id")
    private Long yyBuId;
    @ApiModelProperty(value = "[20201203][小课]事业部")
    private String yyBuName;

    @ApiModelProperty(value = "[20201203][小课]SKU架构id")
    private Long yySkuOrgId;
    @ApiModelProperty(value = "[20201203][小课]SKU架构")
    private String yySkuOrgName;


//    @ApiModelProperty(value = "[小课]运营组长id")
//    private Long yyGroupLeaderId;
//    @ApiModelProperty(value = "[小课]运营组长")
//    private String yyGroupLeaderName;
    @ApiModelProperty(value = "[小课]运营组id")
    private Long yyGroupId;
    @ApiModelProperty(value = "[小课]运营组")
    private String yyGroupName;
//
//    @ApiModelProperty(value = "[小课]运营部长id")
//    private Long yyDeptLeaderId;
//    @ApiModelProperty(value = "[小课]运营部长")
//    private String yyDeptLeaderName;
    @ApiModelProperty(value = "[小课]运营部id")
    private Long yyDeptId;
    @ApiModelProperty(value = "[小课]运营部")
    private String yyDeptName;
//
//    @ApiModelProperty(value = "[小课]工作室老师id")
//    private Long yyStudioLeaderId;
//    @ApiModelProperty(value = "[小课]工作室老师")
//    private String yyStudioLeaderName;
    @ApiModelProperty(value = "[小课]老师工作室id")
    private Long yyStudioId;
    @ApiModelProperty(value = "[小课]老师工作室")
    private String yyStudioName;

    @ApiModelProperty(value = "[小课]投放工作室id")
    private Long tfStudioId;
    @ApiModelProperty(value = "[小课]投放工作室")
    private String tfStudioName;

    @ApiModelProperty(value = "[小课]投放人员id")
    private Long tfFzId;
    @ApiModelProperty(value = "[小课]投放人员")
    private String tfFzName;


    @ApiModelProperty(value = "[20201104][二阶]机会id")
    private Long soChanceId;
    @ApiModelProperty(value = "[20201104][二阶]关联状态")
    private Integer soChanceStates;
    @ApiModelProperty(value = "[20201104][二阶]关联状态显示内容")
    private String soChanceStateStr;
    @ApiModelProperty(value = "[20201104][二阶]机会状态：0-无归属，1-一阶，2-二阶")
    private Integer soOperationStage;
    @ApiModelProperty(value = "[20201104][二阶]流水归属")
    private String soOrderBelong;
    @ApiModelProperty(value = "[20201104][二阶]二阶运营老师id")
    private Long soTeacherId;
    @ApiModelProperty(value = "[20201104][二阶]二阶运营老师")
    private String soTeacherName;
    @ApiModelProperty(value = "[20201214]续报类型：二阶类型：1-续报专用，2-流量复用，3-拉新裂变（转介绍）")
    private Integer soContinueType;



    public String getSoOrderBelong() {
        if(soOperationStage != null){
            if(soOperationStage == 1){
                soOrderBelong = "一阶【" + this.yyTeacherName + "】";
            }else if(soOperationStage == 2){
                soOrderBelong = "二阶【" + this.soTeacherName + "】";
            }
        }

        return soOrderBelong;
    }

    public String getSoChanceStateStr() {

        if(this.soChanceId != null){
            if(soChanceStates == null){

                soChanceStateStr = "订单取消";

            }else if(soChanceStates == 0){
                soChanceStateStr = "正常";
            }else if(soChanceStates == 1){
                soChanceStateStr = "订单取消";
            }else if(soChanceStates == 2){
                soChanceStateStr = "未关联（关联取消）";
            }else if(soChanceStates == 3){
                soChanceStateStr = "未关联（续报取消）";
            }
        }else {
            this.soChanceStateStr = "未关联";
        }

        return soChanceStateStr;
    }

    public String getBoOrderChannelTypeName() {

        boOrderChannelTypeName = OrderChannelType.getTypeName(this.boOrderChannelType);

        return boOrderChannelTypeName;
    }
}